The Component Manager provides two techniques that allow a component to call other components. First, your component may invoke the services of another component using the standard mechanisms also used by applications. The Component Manager then passes the requests to the appropriate component, and your component receives the results of those requests.
Second, your component may supplement its capabilities by using the services of another component to directly satisfy application requests. The Component Manager provides the DelegateComponentCall function, which allows your component to pass a request to a specified component. For example, you might want to create two similar components that provide different levels of service to applications. Rather than completely implementing both components, you could design one to rely on the capabilities of the other. In this manner, you have to implement only that portion of the more capable component that provides additional services.
The DelegateComponentCall function provides an efficient mechanism for passing on requests to a specified component. Your component must open a connection to the component to which the requests are to be passed. Your component must close that connection when it has finished using the services of the other component.
The DelegateComponentCall function does not accept a component identifier in place of a component instance. In addition, your component should never use the DelegateComponentCall function with open or close requests from the Component Manager--always use the OpenComponent and CloseComponent functions to manage connections with other components.
FUNCTION DelegateComponentCall
(originalParams: ComponentParameters;
ci: ComponentInstance): LongInt;
The DelegateComponentCall function calls the component instance specified by the ci parameter, and passes it the specified component parameters record. DelegateComponentCall returns a long integer containing the component result returned by the specified component.
See "The Component Parameters Record" for a description of the component parameters record. See OpenDefaultComponent , OpenComponent , and CloseComponent , respectively, for information on the OpenDefaultComponent , OpenComponent , and CloseComponent functions.
See Listing 16 for an example of the use of the DelegateComponentCall function.